package org.cerberus.platform.ograph;

import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.io.File;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class NativeClasses {

	public static Class<?>[] NATIVE_CLASSES 
				= new Class<?>[]{
		int.class,
		short.class,
		long.class,
		double.class,
		byte.class,
		boolean.class,
		float.class,
		char.class,
		String.class,
		Integer.class,
		Long.class,
		Short.class,
		Double.class,
		Byte.class,
		Boolean.class,
		Float.class,
		Throwable.class,
		Character.class,
		Date.class,
		File.class,
		URL.class,
		URI.class,
		BigDecimal.class,
		BigInteger.class,
		Number.class,
		// swing/awt classes
		Image.class,
		Font.class,
		Color.class,
	};
	
	private static final List<Class<?>> classes = Arrays.asList(NATIVE_CLASSES);
	
	private static final Map< Class<?>, String> classIDs = new HashMap<Class<?>, String>();
	static {
		for (int i = 0; i < NATIVE_CLASSES.length; i++) {
			Class<?> clazz = NATIVE_CLASSES[i];
			classIDs.put(clazz, "system."+clazz.getCanonicalName());
		}
	}
	
	public static boolean isNativeClassID(String classID) {
		return classID.startsWith("system.");
	}
	
	public static boolean isNativeClass(Class<?> clazz) {
		return classes.contains(clazz);
	}
	
	public static String getNativeClassID(Class<?> clazz) {
		return classIDs.get(clazz);
	}
	
}
